package cate.game.play.skill.passive.hero;

import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.ActionCtx;
import cate.game.play.proce.action.ctx.SkillActionCtx;
import cate.game.play.skill.passive.PassiveHandler;
import easy.java.dev.note.NoteField;

/**
 *该回合未暴击则下回合增加7%暴击率，暴击后重制
 */
public class 对影月闪PH extends PassiveHandler {

	@NoteField("暴击buff")
	private int 暴击buff;

	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		暴击buff = args.getInt("暴击buff", 0);
	}


	private boolean roundStrike;

	@Override
	public void onRoundEnd(ActionCtx action) {
		if (!roundStrike) {
			skill.owner.buff.tryAddByTid(action, 暴击buff);
		}
		roundStrike = false;
	}

	@Override
	public void afterOtherOneAttack(SkillActionCtx action, Fighter target, long totalDamage, boolean strike) {
		if (this.roundStrike) {
			return;
		}
		if (strike) {
			this.roundStrike = true;
			skill.owner.buff.removeBuffByTid(action, 暴击buff);
		}
	}
}
